package com.qfedu.qfoffice.controller;

import com.qfedu.qfoffice.entity.DepartNum;
import com.qfedu.qfoffice.entity.ResponseData;
import com.qfedu.qfoffice.service.DepartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 部门相关
 */
@RestController //@Controller + @ResponseBody
public class DepartController {

    @Autowired
    private DepartService departService;

    @RequestMapping("/getDepartNum.do")
    public ResponseData<DepartNum> getDepartNum(){

        ResponseData<DepartNum> responseData = new ResponseData<>();


        try {
            DepartNum departNum = departService.getDepartNum();

            responseData.setCode(0);
            responseData.setData(departNum);
            return responseData;
        }catch (Exception e){

            responseData.setCode(1);
            responseData.setMsg("服务异常");
        }

        return responseData;
    }

}
